package com.amit;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HelloServlet extends HttpServlet
{

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		//1.collect the request parameters
		String nm=request.getParameter("name");
		String em=request.getParameter("email");
		
		String msg=request.getAttribute("MSG").toString();
		
		RequestDispatcher rd1=request.getRequestDispatcher("header.jlc");
		rd1.include(request, response);
		PrintWriter out=response.getWriter();
		out.println("<br/><br/>");
		out.println("<h1>"+msg+"</h1>");
		out.println("<h1>"+msg+"</h1>");
		out.println("<br/><br/>");
		RequestDispatcher rd2=request.getRequestDispatcher("footer.html");
		rd2.include(request, response);
		
	}

}
